package com.nbsaas.boot.manufacturing.rest.resource;

import com.nbsaas.boot.manufacturing.api.apis.ProductionPlanApi;
import com.nbsaas.boot.manufacturing.data.entity.ProductionPlan;
import com.nbsaas.boot.manufacturing.api.domain.request.ProductionPlanRequest;
import com.nbsaas.boot.manufacturing.api.domain.response.ProductionPlanResponse;
import com.nbsaas.boot.manufacturing.api.domain.simple.ProductionPlanSimple;
import com.nbsaas.boot.manufacturing.rest.convert.ProductionPlanSimpleConvert;
import com.nbsaas.boot.manufacturing.rest.convert.ProductionPlanEntityConvert;
import com.nbsaas.boot.manufacturing.rest.convert.ProductionPlanResponseConvert;
import com.nbsaas.boot.manufacturing.data.repository.ProductionPlanRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   生产计划-业务接口实现
*/
@Transactional
@Service
public class ProductionPlanResource extends BaseResource<ProductionPlan,ProductionPlanResponse, ProductionPlanSimple, ProductionPlanRequest>  implements ProductionPlanApi {

    @Resource
    private ProductionPlanRepository productionPlanRepository;

    @Override
    public JpaRepositoryImplementation<ProductionPlan, Serializable> getJpaRepository() {
        return productionPlanRepository;
    }

    @Override
    public Function<ProductionPlan, ProductionPlanSimple> getConvertSimple() {
        return new ProductionPlanSimpleConvert();
    }

    @Override
    public Function<ProductionPlanRequest, ProductionPlan> getConvertForm() {
        return new ProductionPlanEntityConvert();
    }

    @Override
    public Function<ProductionPlan, ProductionPlanResponse> getConvertResponse() {
        return new ProductionPlanResponseConvert();
    }




}


